#基数排序
def radix_sort(arr):
    max_arr = max(arr)
    d = len(str(max_arr))
    for k in range(d):
        s = [[] for i in range(10)]
        for i in arr:
            s[i//(10**k)%10].append(i)
        arr = [j for i in s for j in i]
    return arr
print(radix_sort([5,5,5,2,3,8,1])) 
